import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'

// 1. 引入vue-resource
// import VueResource from 'vue-resource'
// 2. 注册vue-resource
// Vue.use(VueResource)


// 设置本地调试和真机调试的ip  没有域名的情况 
const host = localStorage.getItem('ip') || '127.0.0.1'

import axios from 'axios'
Vue.prototype.$http = axios
// 配置axios的根路径
axios.defaults.baseURL = `http://${host}:5000/`


const options = {
  // loading: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1558501159497&di=17d42c67171714fcceb44783d4f8069d&imgtype=0&src=http%3A%2F%2Fnews.eeeqi.cn%2Fd%2Ffile%2Fcontent%2F2016%2F07%2F578f3bca605e7.jpg'
}

import { Popup, SubmitBar, Switch, Stepper, NavBar, Swipe, SwipeItem, Tabbar, TabbarItem, Card, Button, Tab, Tabs, Lazyload, Panel } from 'vant'

Vue
  .use(Popup)
  .use(NavBar)
  .use(Tabbar).use(TabbarItem)
  .use(Swipe).use(SwipeItem)
  .use(Card)
  .use(Button)
  .use(Tab).use(Tabs)
  .use(Lazyload, options)
  .use(Panel)
  .use(Stepper)
  .use(Switch)
  .use(SubmitBar)


// 定义全局的时间过滤器 

import moment from 'moment'

Vue.filter('datefmt', (date, arg = "YYYY-MM-DD hh:mm:ss") => {
  return moment(date).format(arg)
})


Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
